//
// GPSMapEdit
// (c) Konstantin Galichsky (kg@geopainting.com), 2002-2004
//
// Message box helpers.
//

# include "StdAfx.h"
# include "MapView.h"
# include "Globals.h"

void __cdecl ErrorMsgBox (const char * _strFormat, ...) {
	va_list vl;
	va_start (vl, _strFormat);

	char strBuf [MAX_PATH*2];
	::_vsnprintf (strBuf, sizeof (strBuf), _strFormat, vl);

	::MessageBox (g_hMapWnd, strBuf, MAIN_TITLE, MB_OK | MB_ICONERROR);

	va_end (vl);
}

void __cdecl WarningMsgBox (const char * _strFormat, ...) {
	va_list vl;
	va_start (vl, _strFormat);

	char strBuf [MAX_PATH*2];
	::_vsnprintf (strBuf, sizeof (strBuf), _strFormat, vl);

	::MessageBox (g_hMapWnd, strBuf, MAIN_TITLE, MB_OK | MB_ICONWARNING);

	va_end (vl);
}

void __cdecl InfoMsgBox (const char * _strFormat, ...) {
	va_list vl;
	va_start (vl, _strFormat);

	char strBuf [MAX_PATH*2];
	::_vsnprintf (strBuf, sizeof (strBuf), _strFormat, vl);

	::MessageBox (g_hMapWnd, strBuf, MAIN_TITLE, MB_OK | MB_ICONINFORMATION);

	va_end (vl);
}

bool __cdecl YesNoMsgBox (const char * _strFormat, ...) {
	va_list vl;
	va_start (vl, _strFormat);

	char strBuf [MAX_PATH*2];
	::_vsnprintf (strBuf, sizeof (strBuf), _strFormat, vl);

	const bool bYes = ::MessageBox (g_hMapWnd, strBuf, MAIN_TITLE, MB_YESNO | MB_ICONQUESTION) == IDYES;

	va_end (vl);

	return bYes;
}
